package com.tads.torry.messagecenter.domain.renderer;

import cn.hutool.extra.template.Template;
import cn.hutool.extra.template.TemplateConfig;
import cn.hutool.extra.template.TemplateEngine;
import cn.hutool.extra.template.TemplateUtil;

import java.util.Map;

/**
 * @author Administrator
 */
public class VelocityTemplateRenderer {

    public static String doRender(String templateContent, Map<String, Object> params) {
        TemplateConfig templateConfig = new TemplateConfig();
        templateConfig.setResourceMode(TemplateConfig.ResourceMode.STRING);
        TemplateEngine engine = TemplateUtil.createEngine(templateConfig);
        Template msgTemplate = engine.getTemplate(templateContent);
        return msgTemplate.render(params);
    }
}
